<template>

  <view class="container">
    <view class="title">{{ title }}</view>
    <view class="time">
      <text>{{ msg_type }}</text>
      <text>{{ time }}</text>
    </view>
    <view class="content">
      <htmlParser :parserName="parserName" :parserContent.sync="content" :parserType="parserType"></htmlParser>
    </view>
  </view>

</template>

<script>
import htmlParser from '@/components/htmlparse';
import wxRequest from '@/utils/wxRequest';

export default {
  data() {
    return {

        parserName: 'article',
        parserType: 'md',
        title: '',
        time: '',
        content: '',
        msg_type: ''

    };
  },

  onLoad(options) {
    this.getArticle(options.id);
  },

  mixins: [],
  components: {
    htmlParser: htmlParser
  },
  props: {},
  methods: {
    async getArticle(id) {
      const data = await wxRequest.Get(`message/${id}`);
      this.title = data.title;
      this.content = data.content;
      this.time = data.time;
      this.parserType = data.content_type;
      this.msg_type = data.msg_type;
      this.$invoke('htmlParser', 'htmlParserNotice');
    }

  },
  computed: {},
  watch: {}
};
</script>
<style lang="less">

  .container {
    // background: #f8f8f8;
    height: 100%;
    padding: 12px 24px;
    > .title {
      font-size: 26px;
    }
    > .time {
      font-size: 16px;
      color: #757575;
      margin-top: 8px;
      > text {
        margin-right: 8px;
      }
    }
    .content {
      margin-top: 8px;
    }
  }

</style>